﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;
using DreamBuilder.DictionaryAccess;

namespace DreamBuilder.UI.UserControls.DataAccess.Services
{
    public abstract class UCListDAL : UserControlsDataAccessBase
    {
       
        abstract public DataTable SelectListPaged(string select, string from, string where, string orderBy, string ascOrDesc, int intPageIndex, int intPageSize, out int recordCount,Dictionary<string,string> dictionary);
        abstract public void GenerateListSql(CVoucherListItemInfo pListItemInfo, ref string selectSql, ref string fromSql, ref int columnIndex, Dictionary<string, string> tempDictionary);
        abstract public string GetRestrictFKField(string tableCode,string refTableCode);

        public DataTable GetExportData(string selectSql, string fromSql, string whereSql,string order)
        {
            string sSql = " select " + selectSql + " from " + fromSql + " where 1 = 1 " + whereSql;
            if (!string.IsNullOrEmpty(order))
            {
                sSql =sSql + " order by "+order;
            }
            return DBHelper.ExecuteDataSet(sSql).Tables[0].Copy();
        }


    }
}
